From 2a71b8f897e716abea7db82552c381463182d4d5 Mon Sep 17 00:00:00 2001 From: lzwind Date: Wed, 5 Aug 2026 08:59:56 +0800 Subject: [PATCH] find-remotes: Don't require write access to repo unless pulling ostree find-remotes is a read-only operation that searches for remotes which have a given collection-ref. It should not require write access to the repository. Only when --pull is used does the command actually write to the repo. Move the ostree_ensure_repo_writable() check to just before the pull phase so that read-only find-remotes works on read-only repositories. Closes #3585 --- src/ostree/ot-builtin-find-remotes.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/ostree/ot-builtin-find-remotes.c b/src/ostree/ot-builtin-find-remotes.c index 7475aaa6..600f3769 100644 --- a/src/ostree/ot-builtin-find-remotes.c +++ b/src/ostree/ot-builtin-find-remotes.c @@ -190,9 +190,6 @@ ostree_builtin_find_remotes (int argc, char **argv, OstreeCommandInvocation *inv error)) return FALSE; - if (!ostree_ensure_repo_writable (repo, error)) - return FALSE; - if (argc < 3) { ot_util_usage_error (context, "At least one COLLECTION-ID REF pair must be specified", error); @@ -363,6 +360,10 @@ ostree_builtin_find_remotes (int argc, char **argv, OstreeCommandInvocation *inv if (!opt_pull) return TRUE; + /* Pulling requires write access to the repository. */ + if (!ostree_ensure_repo_writable (repo, error)) + return FALSE; + { GVariantBuilder builder; g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); -- 2.39.5